package com.shujia.mr.hw.filter1;

import org.apache.hadoop.io.Writable;

import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;

public class Student implements Writable {
    String studentID;
    String name;
    String age;
    String gender;
    String clazz;
    String score;

    public Student() {
    }

    public Student(String studentID, String name, String age, String gender, String clazz, String score) {
        this.studentID = studentID;
        this.name = name;
        this.age = age;
        this.gender = gender;
        this.clazz = clazz;
        this.score = score;
    }

    @Override
    public String toString() {
        return "Student{" +
                "studentID='" + studentID + '\'' +
                ", name='" + name + '\'' +
                ", age='" + age + '\'' +
                ", gender='" + gender + '\'' +
                ", clazz='" + clazz + '\'' +
                ", score='" + score + '\'' +
                '}';
    }

    public String getStudentID() {
        return studentID;
    }

    public void setStudentID(String studentID) {
        this.studentID = studentID;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getAge() {
        return age;
    }

    public void setAge(String age) {
        this.age = age;
    }

    public String getGender() {
        return gender;
    }

    public void setGender(String gender) {
        this.gender = gender;
    }

    public String getClazz() {
        return clazz;
    }

    public void setClazz(String clazz) {
        this.clazz = clazz;
    }

    public String getScore() {
        return score;
    }

    public void setScore(String score) {
        this.score = score;
    }

    // 将当前对象写出
    @Override
    public void write(DataOutput out) throws IOException {
        out.writeUTF(studentID);
        out.writeUTF(name);
        out.writeUTF(age);
        out.writeUTF(gender);
        out.writeUTF(clazz);
        out.writeUTF(score);
    }


    // 将对象写入
    @Override
    public void readFields(DataInput in) throws IOException {
        studentID = in.readUTF();
        name = in.readUTF();
        age = in.readUTF();
        gender = in.readUTF();
        clazz = in.readUTF();
        score = in.readUTF();
    }
}
